<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >
<title>Getting Started</title>

<link href="book.css" rel="stylesheet" type="text/css">
<link href="code.css" rel="stylesheet" type="text/css">
<link rel="home" href="00-Main.html" title="">
</head>
<body>
<a name="GettingStarted"></a>
<h1>Getting Started</h1>
<a name="Install"></a>
<h2>Installation of Xsemantics</h2>
<p>
To get started, you should first install Xsemantics plugins;
you can use the update site:
<a href="https://dl.bintray.com/lorenzobettini/xsemantics/updates">https://dl.bintray.com/lorenzobettini/xsemantics/updates</a>.
</p>
<p>
Note that this composite update site contains links also to the
official Xtext update site, so, if you don&apos;t have Xtext already installed,
you can install Xtext also from Xsemantics&apos; update site.
</p>
<p>
The Java code generated by Xsemantics will depend only
on the plugin <span class="inlinecode">org.eclipse.xsemantics.runtime</span>.  Thus, in case you want to deploy
your Xtext language implemented making use of Xsemantics, your language will
NOT need to depend on the whole Xsemantics SDK: you only need the <em>Runtime</em>
feature of Xsemantics.
</p>
<p>
The Xsemantics SDK contains all the features of Xsemantics, including
the examples, so, if you want to use Xsemantics for your DSL, installing
this SDK would be the best thing (you may also wanto to install the sources,
so that you can inspect Xsemantics classes).
</p>
<a name="Sources"></a>
<h3>Sources</h3>
<p>
Sources of Xsemantics (and the examples, <a href="Examples.html#Examples" title="Go to &quot;Examples&quot;" >section Examples</a>) are available
from the git repository, please visit
<a href="https://github.com/LorenzoBettini/xsemantics">https://github.com/LorenzoBettini/xsemantics</a>.
</p>
<p>
You might want to consider using <a href="https://wiki.eclipse.org/Eclipse_Oomph_Installer">Oomph</a>
to easily materialize Xsemantics sources into your workspace, together with all
the needed bundles in the target platform, as illustrated in <a href="GettingSources.html#GettingSources" title="Go to &quot;Getting Sources&quot;" >section GettingSources</a>.
</p>
<a name="UsingXsemantics"></a>
<h2>Using Xsemantics</h2>
<p>
Before you start using Xsemantics for your Xtext language, you
should add in your plugin project the following dependency:
<span class="inlinecode">org.eclipse.xsemantics.runtime</span>.
</p>
<p>
To check whether your settings work correctly,
</p>
<p>
<ol>
	<li>
		you can create an Xtext project,
		accepting the defaults;
	</li>
	<li>
		add the dependency
		<span class="inlinecode">org.eclipse.xsemantics.runtime</span>;
	</li>
	<li>
		create a file with extension <span class="inlinecode">xsemantics</span> in a subdirectory of one of your
			source folders;
	</li>
	<li>
		give a name to your <span class="inlinecode">system</span>, and save;
	</li>
	<li>
		you should now have in your project an additional folder <span class="inlinecode">xsemantics-gen</span>,
			where Xsemantics generates the Java file; make sure to set that folder as a source
			folder (and don&apos;t forget to add it also to your <span class="inlinecode">build.properties</span> file.
	</li>
</ol>
</p>
<p>
If you see something similar to the following screenshot you should be fine.
</p>
<p>
<div class="image" >
<img src="images/first-xsemantics-file.png" class=" " 
 style="width:90%" />
<div class="caption">
An xsemantics file and generated code
</div>
</div>
</p>
<p>
Xsemantics will generate Java classes as explained in <a href="XsemanticsSyntax.html#CodeGeneration" title="Go to &quot;Generated Code&quot;" >section CodeGeneration</a>.
</p>
<a name="UsingXsemanticsMaven"></a>
<h2>Using Xsemantics in Maven builds</h2>
<p>
Xsemantics provides Maven artifacts that can be used during a Maven build.
The artifacts include the runtime library of Xsemantics and the DSL compiler.
</p>
<p>
IMPORTANT: since version 1.8.1 such Maven artifacts are available from Maven central, and
the <em>groupId</em> is <em>org.eclipse.xsemantics</em>.
</p>
<p>
For example
</p>
<p>
<div class="literallayout">
<div class="incode">
<p class="code">
&lt;dependency&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.eclipse.xsemantics&lt;/groupId&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;org.eclipse.xsemantics.dsl&lt;/artifactId&gt;<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;version&gt;${xsemantics.version}&lt;/version&gt;<br/>
&lt;/dependency&gt;<br/>
</p>
</div>
</div>
</p>
<p>
The DSL compiler can be used together with the <em>xtext-maven-plugin</em>.
</p>
<p>
An example can be found here
<a href="https://github.com/LorenzoBettini/xsemantics/tree/master/tests/org.eclipse.xsemantics.example.maven.test">https://github.com/LorenzoBettini/xsemantics/tree/master/tests/org.eclipse.xsemantics.example.maven.test</a>.
</p>
</body>
</html>
